Run your Flutter app on the web with Ditto.
ditto_live
package to your pubspec.yaml
file with the version 4.9.1-web-preview.0
:
await Ditto.init()
. By default, assets are bundled with the application and loaded
from the same web server that serves the application. After running flutter build web
, you can find those in the
build/web/assets/packages/ditto_live/lib/assets
directory.
Alternatively, you can host the contents of that directory on a CDN or other web
server and configure Ditto to load assets from there. All contents of the
directory, excluding the ditto.wasm
file itself, must be reachable at the URL
given by the wasmShimUrl
parameter. The ditto.wasm
file can be served from a
separate URL given by the wasmUrl
parameter.
Configuration for loading all assets from a CDN:
kIsWeb
constant to conditionally
request permissions only on mobile platforms.